package com.weds.edpf.core.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import java.util.Date;
import java.util.List;

import com.weds.core.base.BaseService;
import com.weds.edpf.core.mapper.XfAcTimeMapper;
import com.weds.edpf.core.entity.XfAcTimeEntity;

/**
 * @Author sxm
 * @Description XfAcTime管理
 * @Date 2020-06-11
 */
@Service
public class XfAcTimeService extends BaseService {

    @Autowired
    private XfAcTimeMapper xfAcTimeMapper;

    private Logger log = LogManager.getLogger();

    public int deleteByPrimaryKey(Integer xh) {
        return xfAcTimeMapper.deleteByPrimaryKey(xh);
    }

    public int insert(XfAcTimeEntity record) {
        return xfAcTimeMapper.insert(record);
    }

    public int insertSelective(XfAcTimeEntity record) {
        return xfAcTimeMapper.insertSelective(record);
    }

    public XfAcTimeEntity selectByPrimaryKey(Integer xh) {
        return xfAcTimeMapper.selectByPrimaryKey(xh);
    }

    public int updateByPrimaryKeySelective(XfAcTimeEntity record) {
        return xfAcTimeMapper.updateByPrimaryKeySelective(record);
    }

    public int updateByPrimaryKey(XfAcTimeEntity record) {
        return xfAcTimeMapper.updateByPrimaryKey(record);
    }

    public List<XfAcTimeEntity> selectListByEntity(XfAcTimeEntity record) {
        return xfAcTimeMapper.selectListByEntity(record);
    }


    public int deleteBatchByKeys(List<XfAcTimeEntity> list) {
        return xfAcTimeMapper.deleteBatchByKeys(list);
    }

    public int insertBatch(List<XfAcTimeEntity> list) {
        return xfAcTimeMapper.insertBatch(list);
    }

    /**
     * 插入场所消费默认时段
     * @param depSerial
     */
    public void insertLog(Integer depSerial,String glyNo) {

        XfAcTimeEntity xfEntity = new XfAcTimeEntity();
        xfEntity.setLx(2);
        xfEntity.setAcdepSerial(depSerial);
        xfEntity.setDayOffset(0);
        xfEntity.setSj(new Date());
        xfEntity.setGlyNo(glyNo);
        xfEntity.setEachUnit(0);
        xfEntity.setMouldType(0);
        xfEntity.setDayOrder(1);
        xfEntity.setTimeNo("2011101113313453");
        this.insertSelective(xfEntity);

        xfEntity.setDayOrder(2);
        xfEntity.setTimeNo("2011101113315133");
        this.insertSelective(xfEntity);

        xfEntity.setDayOrder(3);
        xfEntity.setTimeNo("2011101113322857");
        this.insertSelective(xfEntity);

        xfEntity.setDayOrder(4);
        xfEntity.setTimeNo("2011101113330182");
        this.insertSelective(xfEntity);
    }


}
